﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FDEE.Model;
using MathNet.Spatial.Euclidean;
using System.Data;

namespace ConsoleTest
{

    class Program
    {
        static void Main(string[] args)
        {
            BillTest();
            //var slb = new TDeckSlab("", "", 20560, 120000, 2, 3, 8);
            ////var slb = new TDeckSlabCurve("", "", 8700, 6300, 30000, 396500, 0, 800, eEndType.LinkSlab, eEndType.LinkSlab);

            //slb.SetConcreteClass();
            //slb.SetConcreteVolume();
            //slb.SetRebarList();

            //var kk = new RCPlate("", "", 1550, eSubType.A, false);
            //kk.SetConcreteClass();
            //kk.SetConcreteVolume();
            //kk.SetRebarList();

            //var k01 = MemberFactory.CreatMember("Sta. 0+189.362", EFootingType.FMHK, eSubType.None, 25646, 2259, 12, 400);
            //var k02 = MemberFactory.CreatMember("Sta. 0+195.751", EFootingType.FMHK, eSubType.None, 31698, 2207, 15, 400);
            //var k03 = MemberFactory.CreatMember("Sta. 0+204.483", EFootingType.FMHK, eSubType.None, 38197, 2200, 18, 400);
            //var k04 = MemberFactory.CreatMember("Sta. 0+211.554", EFootingType.FMHK, eSubType.None, 42822, 2335, 19, 400);
            //var k05 = MemberFactory.CreatMember("Sta. 0+217.778", EFootingType.FMHK, eSubType.None, 45858, 2371, 20, 400);
            //var k06 = MemberFactory.CreatMember("Sta. 0+226.220", EFootingType.FMHK, eSubType.None, 34022, 2215, 16, 400);
            //var k07 = MemberFactory.CreatMember("Sta. 0+231.493", EFootingType.FMHK, eSubType.None, 20242, 2160, 10, 400);
            //var k08 = MemberFactory.CreatMember("Sta. 0+236.604", EFootingType.FMHK, eSubType.None, 16388, 2227, 8, 400);
            //var k09 = MemberFactory.CreatMember("Sta. 0+241.632", EFootingType.FMHK, eSubType.None, 13133, 2055, 7, 400);
            //var k10 = MemberFactory.CreatMember("Sta. 0+246.632", EFootingType.FMHK, eSubType.None, 10574, 1955, 6, 400);
            //var k11 = MemberFactory.CreatMember("Sta. 0+252.632", EFootingType.FMHK, eSubType.None, 8493, 1923, 5, 400);
            //var k12 = MemberFactory.CreatMember("Sta. 0+259.132", EFootingType.FMHK, eSubType.None, 7173, 2124, 4, 400);
            //foreach (var item in new FootingBase[] { k01, k02, k03, k04, k05, k06, k07, k08, k09, k10, k11, k12 })
            //{
            //    if (item.RebarList.Count() == 2)
            //    {
            //        Console.WriteLine("0");
            //    }
            //    else
            //    {
            //        Console.WriteLine(item.RebarList[2]);
            //    }
            //}
            //var f = k01.RebarList;

            PileTest();


            // PME4-T1
            //List<Point2D> PT = new List<Point2D>()
            //{
            //    new Point2D(0 , 2.2),new Point2D(2.5 , 1.8),new Point2D(5 , 1.45),new Point2D(7.5 , 1.15),
            //    new Point2D(10 , 0.9),new Point2D(12.5 , 0.85),new Point2D(15 , 0.8),new Point2D(17.5 , 0.8),
            //    new Point2D(20 , 0.8),new Point2D(22.5 , 0.836),new Point2D(25 , 0.871),new Point2D(27 , 0.9),
            //    new Point2D(29.5 , 1),new Point2D(32 , 1.1),new Point2D(34.5 , 1.4),new Point2D(37 , 1.7),
            //    new Point2D(39.5 , 1.75),new Point2D(42 , 1.8),new Point2D(44.5 , 1.785),new Point2D(47 , 1.77),
            //    new Point2D(49.5 , 1.735),new Point2D(52 , 1.7),

            //};
            //DataColumn dc;
            //DataTable ElongTable = new DataTable("伸长量计算参数表");
            //dc = new DataColumn("No", typeof(string));
            //ElongTable.Columns.Add(dc);
            //dc = new DataColumn("Location", typeof(double));
            //ElongTable.Columns.Add(dc);
            //dc = new DataColumn("k", typeof(double));
            //ElongTable.Columns.Add(dc);
            //dc = new DataColumn("μ", typeof(double));
            //ElongTable.Columns.Add(dc);
            //dc = new DataColumn("θst", typeof(double));
            //ElongTable.Columns.Add(dc);
            //dc = new DataColumn("θed", typeof(double));
            //ElongTable.Columns.Add(dc);
            //dc = new DataColumn("fp0_st", typeof(double));
            //ElongTable.Columns.Add(dc);
            //dc = new DataColumn("fp0_ed", typeof(double));
            //ElongTable.Columns.Add(dc);
            //dc = new DataColumn("fp_st", typeof(double));
            //ElongTable.Columns.Add(dc);
            //dc = new DataColumn("fp_ed", typeof(double));
            //ElongTable.Columns.Add(dc);
            //dc = new DataColumn("fp", typeof(double));
            //ElongTable.Columns.Add(dc);
            //dc = new DataColumn("dl", typeof(double));
            //ElongTable.Columns.Add(dc);
            //dc = new DataColumn("Ep", typeof(double));
            //ElongTable.Columns.Add(dc);
            //dc = new DataColumn("△L", typeof(double));
            //ElongTable.Columns.Add(dc);

            //var f = new PLTendonRecord(1, 1, eStrandClass.S152, 31, eForceType.BothEnd, 6131, PT);
            //f.SetLength();
            //f.SetElongation(ref ElongTable);
            //f = new PLTendonRecord(2, 1, eStrandClass.S152, 31, eForceType.BothEnd, 6131, PT);
            //f.SetLength();
            //f.SetElongation(ref ElongTable);
            //f = new PLTendonRecord(3, 1, eStrandClass.S152, 31, eForceType.BothEnd, 6131, PT);
            //f.SetLength();
            //f.SetElongation(ref ElongTable);
            //var test = 1;




            //CrossBeamTest();
            //double ang = Math.Atan(250 / 225.00);
            //double v2 = 250 / Math.Sin(ang);
            ////var vv = 50 - (50 / Math.Tan(ang)) * Math.Sin(ang);
            //var v0 = (50 - (50 / Math.Tan(ang)) * Math.Sin(ang)) / Math.Sin(ang);
            //double A = 900 - 225 * 2 - ((50 - (50 / Math.Tan(ang)) * Math.Sin(ang)) / Math.Sin(ang)) * 2;

            //ang = Math.Atan(225.0 / 250.00);
            //var vv1 = (50 - (50 / Math.Tan(ang)) * Math.Sin(ang)) / Math.Sin(ang);
            //double C = 1400 - 250 * 2 - ((50 - (50 / Math.Tan(ang)) * Math.Sin(ang)) / Math.Sin(ang)) * 2;

            //double B = v2 - v0 - vv1;
            ////FootingTest();
            ////PileTest();
            //BillTest();


        }

        /// <summary>
        /// 胡云天测试专用
        /// </summary>
        static void BillTest()
        {
            //Console.ReadKey();            
            // var cb = MemberFactory.CreatMember(ECrossBeamType.BPTM2, 26000+1600);
            var cb = MemberFactory.CreatMember(eColumnType.CPTM1U,eSubType.C,17558);
            var cb2 = MemberFactory.CreatMember(eColumnType.CPTM1U,eSubType.C,19057);

        }

        /// <summary>
        /// 承台测试
        /// </summary>
        static void FootingTest()
        {

            //var k00 = MemberFactory.CreatMember(EFootingType.FPME41, eSubType.C);
            //var f00 = k00.RebarList;

            //var k = MemberFactory.CreatMember(EFootingType.FPME42, eSubType.C);
            //var f = k.RebarList;
            //k = MemberFactory.CreatMember(EFootingType.FPME41, eSubType.C);
            //f = k.RebarList;
            var k = MemberFactory.CreatMember(EFootingType.FPTM2S, eSubType.C);
            var f = k.RebarList;

            //k = MemberFactory.CreatMember(EFootingType.FPTL2, eSubType.B);
            //k = MemberFactory.CreatMember(EFootingType.FPTE3, eSubType.B);
            //k = MemberFactory.CreatMember(EFootingType.FPTE32, eSubType.B);
            //k = MemberFactory.CreatMember(EFootingType.FPE12, eSubType.B);
            //k = MemberFactory.CreatMember(EFootingType.FPE21A, eSubType.B);
            //k = MemberFactory.CreatMember(EFootingType.FPE21B, eSubType.B);
            k = MemberFactory.CreatMember(EFootingType.FPE22, eSubType.B);
            k = MemberFactory.CreatMember(EFootingType.FPE22, eSubType.BM);
            k = MemberFactory.CreatMember(EFootingType.FPTE3, eSubType.C);
            k = MemberFactory.CreatMember(EFootingType.FPTE32, eSubType.C);
            k = MemberFactory.CreatMember(EFootingType.FPE32, eSubType.C);
            f = k.RebarList;
            k = MemberFactory.CreatMember(EFootingType.F2PTM2, eSubType.C);
            f = k.RebarList;
            var k0 = MemberFactory.CreatMember(EFootingType.FPTM3S, eSubType.C);
            k0 = MemberFactory.CreatMember(EFootingType.FPTM3S, eSubType.D);
            var f0 = k.RebarList;

            Console.ReadKey();

        }
        static void PileTest()
        {
            //var k1 = MemberFactory.CreatMember(EPileType.Type600, eSubType.None, 18450);
            //var k = k1 as MemberBase;
            //var f = k1.RebarList;
            //var m = (from w in f select w.TotalWeight).ToList();
            //var tw = m.Sum();
            //var kT = MemberFactory.CreatMember(EPileType.Type1, eSubType.None, 30);
            var kT = MemberFactory.CreatMember(EPileType.Type5, eSubType.None, 50,1000,1100);
            var f = kT.RebarList;
            //kT = MemberFactory.CreatMember(EPileType.Type6, eSubType.None, 48, 1000, 1200);
            //f = kT.RebarList;
            kT = MemberFactory.CreatMember(EPileType.Type1, eSubType.None, 39.5, 800, 1200);
            f = kT.RebarList;
            //kT = MemberFactory.CreatMember(EPileType.Type1, eSubType.None, 44.5, 1000, 1200);
            //f = kT.RebarList;
            //kT = MemberFactory.CreatMember(EPileType.Type5, eSubType.None, 45.5, 1000, 1200);
            //f = kT.RebarList;

            //kT = MemberFactory.CreatMember(EPileType.Type4, eSubType.None, 48, 1000, 1200);
            //f = kT.RebarList;
            kT = MemberFactory.CreatMember(EPileType.Type4, eSubType.None, 38.5, 800, 800);
            f = kT.RebarList;
            Console.ReadKey();
        }
        static void CrossBeamTest()
        {
            //var cb = MemberFactory.CreatMember(ECrossBeamType.BPTM2, 28000);
            //var CB = cb as MemberBase;
            //var ll = cb.RebarList;
            //cb = MemberFactory.CreatMember(ECrossBeamType.BPTM1S, 24177 + 1600);
            //CB = cb as MemberBase;
            //ll = cb.RebarList;
            //cb = MemberFactory.CreatMember(ECrossBeamType.BPTM3S, 36133);
            //cb = MemberFactory.CreatMember(ECrossBeamType.BPTM3S, 31600);
            //CB = cb as MemberBase;
            //CB = cb as MemberBase;
            //ll = cb.RebarList;
            //cb = MemberFactory.CreatMember(ECrossBeamType.BPTM3S, 27600);
            //CB = cb as MemberBase;
            //CB = cb as MemberBase;
            //ll = cb.RebarList;
            //cb = MemberFactory.CreatMember(ECrossBeamType.BPTM1, 22200 + 1600);
            //CB = cb as MemberBase;
            //ll = cb.RebarList;
            var cb = MemberFactory.CreatMember(ECrossBeamType.BPME4, 43898, "P-325");
            var CB = cb as MemberBase;
            var ll = cb.RebarList;
            cb = MemberFactory.CreatMember(ECrossBeamType.BPTE32, 25900, "RP-15");
            CB = cb as MemberBase;
            ll = cb.RebarList;
            var cb1 = MemberFactory.CreatMember(ECrossBeamType.BPE22, 8900, "Banana EX-2", "RP-15");
            CB = cb as MemberBase;
            ll = cb.RebarList;
            cb = MemberFactory.CreatMember(ECrossBeamType.BPL2, 11000, "RP-15");
            CB = cb as MemberBase;
            ll = cb.RebarList;
            Console.ReadKey();

        }
    }
}
